<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/common.css" type="text/css" rel="stylesheet" />
<title>云商宝SN撤回查询</title>

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type="text/javascript">
$(document).ready(function(){

      loadYsbBrandCode();

      var orgCode=$("#orgCode").val();
      if(orgCode != ''){
      	//loadOCode();
      }

      $("#sub").click(function(){
         var orgCode = $("#orgCode").val();
         if(orgCode == ''){
           alert("请选择机构");
           return false;
         } 
         if(!checkSn()){
          	return false;
          }
         
         $("#importForm").attr("action","<%=basePath%>/terminal/queryYsbRevocationTerminalPosSN.ct");
		 $("#importForm").submit();
       
      });
   
	   $("#revPower").click(function() {
			var id = 'ysbSnRev';
			var title = '云商宝终端SN撤回';
			var html = "<%=basePath%>/terminal/termYsbRevJsp.ct";
			window.parent.parent.document.getElementById("framemain").contentWindow.addtabs(id,title,html);
		}); 
	//   retPower
   });

	function  checkSn(){   
		var endSn = $("#endSerialNum").val();
		var beginSn = $("#beginSerialNum").val();
		
		if( endSn && !beginSn ){
			alert("开始序列号必须选择!");
			return false;
		}
		return true;
	}
   function loadOCode(){
        var orgCode = $("#orgCode").val();
		if (!orgCode) {
			return;
		}
		
		MccQuery.loadOCode(orgCode, function(sortSmall) {
			fillSelect_sort("accountNo", sortSmall);
		});
   }
   
   	//加载终端名称
	function loadYsbBrandCode() {
	
			var sortCode = $("#posBrand").val();
			 var posName = $("#posName").val();
			
			if (sortCode==null||sortCode=="") {
			//$("#posName").empty().append("<option value='99'>不限</option>");
				return;
			}
			
			MccQuery.loadYsbBrandNameByCode(sortCode, function(sortSmall) {
			   
				fillSelect_sort("posName", sortSmall,posName,sortCode);
				
			});
		}
			
	
	function fillSelect_sort(sid, address,choiseId,sortCode) {
	  		
				if (!address || !sid) {
					return;
				}
				
				var $select = $("#" + sid);
				$select.empty();
				
				$("#" + sid).empty().append("<option value='-1'>不限</option>");
				
		        var selModelCode = $("#selModelCode").val();
		        var oldBandCode = $("#oldBandCode").val();
			   
				for ( var i = 0; i < address.length; i++) {
			        var selStr = "";
					if(selModelCode != null && selModelCode != '' && address[i].CODE == selModelCode 
							&& sortCode == oldBandCode){
						selStr = " selected='selected' ";
					}
					$select.append("<option " + selStr + " value='"+address[i].CODE+"'>"
							+ address[i].NAME + "</option>");
				}
			/* 	if(choiseId!="" && choiseId!=null){
				 $("#" + sid).val(choiseId);
				} */
				
			
		}
</script>
</head>
<body>
<table class="tb">
    <tbody>
		<s:form id="importForm" action="queryYsbRevocationTerminalPosSN.ct" method="post"
			namespace="/terminal"  theme="simple">
			
        <tr class="tb-line">
            <td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div><font color="red">提示：终端品牌、型号后台规整中</font></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="6"><div class="tb-h3">云商宝终端SN撤回查询</div></td>
        </tr>
		<tr class="tb-line">
			<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">终端序列号：</div>
		   </td>
					<td class="tb-td" >
		                <label class="tb-input-normal">
							<s:textfield id="beginSerialNum" name="searchCondition.beginSerialNum" cssClass="queryWidth" />
						</label>
		                <label class="tb-input-normal">
							<s:textfield id="endSerialNum" name="searchCondition.endSerialNum" cssClass="queryWidth" />
						</label>
                	</td>
			            <td align="right" class="tb-td">
			                <div class="tb-h4">品牌：</div>
			            </td>
						<td class="tb-td">
	                		<label class="tb-select">
								<s:select cssClass="queryWidth" name="searchCondition.posBrand"
									id="posBrand" onchange="loadYsbBrandCode()"
									list="#request.brandMap" listKey="key" listValue="value"  headerKey="-1" headerValue="不限"/>
               				</label>
						</td>
			            <td align="right" class="tb-td">
			                <div class="tb-h4">型号：</div>
			            </td>
						<td class="tb-td">
	                		<label class="tb-select">
							
								<s:select label="01"  cssClass="queryWidth" name="searchCondition.posName"
									id="posName"
									list="#request.nameMap" listKey="key" listValue="value"  headerKey="-1" headerValue="不限"/>
								
								<s:hidden id="selModelCode" name="#request.selModelCode"  />
								<s:hidden id="oldBandCode" name="#request.oldBandCode"  />
						
               				</label>
						</td>
					
				</tr>
				

				<tr class="tb-line">
						
			            <td align="right" class="tb-td">
			                <div class="tb-h4">机型：</div>
			            </td>
						<td class="tb-td">
	                		<label class="tb-select">
								<s:select cssClass="queryWidth" name="searchCondition.posType"
									id="orgCode"
									list="#request.typeMap" listKey="key" listValue="value" headerKey="-1" headerValue="不限"/>
               				</label>
						</td>
						
						 <s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
						  <td align="right" width="15%"></td>
						  <td class="tb-td">
			                  <s:hidden name="searchCondition.orgCode" value="%{#session.session_merchant.orgCode}" id="orgCode" />
						  </td>
						</s:if>	
						<s:else>
			            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			                <div class="tb-h4">所属机构：</div>
			            </td>
						<td class="tb-td">
	                		<label class="tb-select">
								<s:select cssClass="queryWidth" name="searchCondition.orgCode"
									id="orgCode"
									list="orgList" listKey="InsIdCd" listValue="InsName"/>
	                		</label>
						</td>
						</s:else>
				</tr>
				<tr>
					<td colspan="6" align="center"><div style="color: blue;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div>
					</td>
				</tr>

				<tr class="tb-line">
					<td class="tb-td line-submit" align="right" colspan="6">
                		<label class="tb-input-submit">
					 		<s:submit value="查询" id="sub" /> 
		                </label>
		                <label class="tb-input-submit">
				             <s:reset value="取  消" />
		                </label>
		                <label class="tb-input-submit">
		                    <input id="revPower" type="button"  value="撤回"  />
		                </label>
					</td>
				</tr>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="12" align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/terminal/queryYsbRevocationTerminalPosSN.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table> 
		</s:form>
    </tbody>
</table>
<div class="big-tb">
    <table class="tb" style="width: 160%;">
				<thead>
		            <tr class="tb-line">
		                <th class="tb-th" colspan="13">终端信息列表</th>
		            </tr>
					<tr class="tb-line bg-gray"><!-- 
                		<th class="tb-th">选择</th> -->
					    <th class="tb-th">终端序列号</th>
						<th class="tb-th">商户号</th>
						<th class="tb-th">终端号</th>
						<th class="tb-th">所属代理商</th>
						<th class="tb-th">品牌</th>
						<th class="tb-th">型号</th>
						<th class="tb-th">机型</th>
						 <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						    <th class="tb-th">所属机构</th>
						 </s:if>
						<th class="tb-th">是否已绑定</th>
						<th class="tb-th">是否有效</th>
						<th class="tb-th">备注</th>
						<th class="tb-th">入库时间</th>
						<th class="tb-th">出库时间</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="term">
						<tr class="tb-line">
						<!-- 	<td align="center" class="tb-td"> -->
								<%-- 状态未绑定,才允许操作 --%>
							<%-- 	<s:if test=" #term.isBind==\"否\" ">
									<s:checkboxlist name="sNum" list="#{#term.serialNum+'_'+#term.posBrandCode :''}" value=""  theme="simple"  />
								</s:if>
								<s:else>
									<s:checkboxlist name="sNum" list="#{#term.serialNum:''}" value=""  theme="simple" disabled="true" />
								</s:else> --%>
					      <!--   </td> -->
							<td class="tb-td" align="center">
							 <s:property value="#term.serialNum"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.mercCode"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.termCode"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.agentName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.posBrand"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.posName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.posType"/>
							</td>
							 <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						       <td class="tb-td" align="center">
								 <s:property value="#term.orgName"/>
								</td>
						     </s:if>
							
							<td class="tb-td" align="center">
							 <s:property value="#term.isBind"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.tekId"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.remark"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.inDateStr"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.outDateStr"/>
							</td>
						</tr>
						</s:iterator>
				</tbody>
    </table>
</div>
	<s:if test="#request.msg !=null">
		<script language="javascript">
		    alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>